//
//  SCShaiXuan.m
//  LoverGo
//
//  Created by liudonghuan on 14-9-14.
//  Copyright (c) 2014年 yexiao. All rights reserved.
//

#import "SCShaiXuan.h"

@implementation SCShaiXuan
@synthesize sxDelegate = _sxDelegate;
- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _step1 = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH/3,36)];
        [_step1 setBackgroundImage:[UIImage imageNamed:@"shaixuan_up"] forState:UIControlStateNormal];
        [_step1 setBackgroundImage:[UIImage imageNamed:@"shaixuan_normal"] forState:UIControlStateHighlighted];
        
        _step2 = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/3 + 1, 0, SCREEN_WIDTH/3, 36)];
        [_step2 setBackgroundImage:[UIImage imageNamed:@"shaixuan_up"] forState:UIControlStateNormal];
        [_step2 setBackgroundImage:[UIImage imageNamed:@"shaixuan_normal"] forState:UIControlStateHighlighted];
        _step3 = [[UIButton alloc]initWithFrame:CGRectMake(2*SCREEN_WIDTH/3 + 1, 0, SCREEN_WIDTH/3, 36)];
        [_step3 setBackgroundImage:[UIImage imageNamed:@"shaixuan_up"] forState:UIControlStateNormal];
        [_step3 setBackgroundImage:[UIImage imageNamed:@"shaixuan_normal"] forState:UIControlStateHighlighted];
        
        [_step1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_step2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_step3 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        _step1.tag = step1;
        _step2.tag = step2;
        _step3.tag = step3;
        [_step1 setTitle:@"餐饮" forState:UIControlStateNormal];
        [_step2 setTitle:@"全部" forState:UIControlStateNormal];
        [_step3 setTitle:@"默认排序" forState:UIControlStateNormal];
        _step1TB = [[UITableView alloc]initWithFrame:CGRectMake(0, 36, SCREEN_WIDTH/3, 60)];
        _step2TB = [[UITableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/3 +1, 36, SCREEN_WIDTH/3, 160)];
        _step3TB = [[UITableView alloc]initWithFrame:CGRectMake(2*SCREEN_WIDTH/3 +1, 36, SCREEN_WIDTH/3, 160)];
        _step1TB.separatorStyle = UITableViewCellSeparatorStyleNone;
        _step2TB.separatorStyle = UITableViewCellSeparatorStyleNone;
        _step3TB.separatorStyle = UITableViewCellSeparatorStyleNone;
        [_step1 addTarget:self action:@selector(stepBtnOnclick:) forControlEvents:UIControlEventTouchUpInside];
        [_step2 addTarget:self action:@selector(stepBtnOnclick:) forControlEvents:UIControlEventTouchUpInside];
        [_step3 addTarget:self action:@selector(stepBtnOnclick:) forControlEvents:UIControlEventTouchUpInside];
        _step1TB.hidden = YES;
        _step2TB.hidden = YES;
        _step3TB.hidden = YES;
        [self addSubview:_step1];
        [self addSubview:_step2];
        [self addSubview:_step3];
        [self addSubview:_step1TB];
        [self addSubview:_step2TB];
        [self addSubview:_step3TB];
        
    }
    return self;
}
-(void)hiddenAllTB
{
    _step1TB.hidden = YES;
    _step2TB.hidden = YES;
    _step3TB.hidden = YES;
    self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 40) ;
}
-(void)stepBtnOnclick:(UIButton *)btn
{
    [_sxDelegate stepBtnOnclick:btn];
}


@end
